#define _CRT_SECURE_NO_WARNINGS 1
#include"Tree.h"
//HP hp;
//void Test1()
//{
//	int a[] = { 27,15,19,18,28,34,65,49,25,37 };
//	HeapAdjustDown(a, 10, 0);
//	for (int i = 0;i < 10;i++)
//	{
//		printf("%d ", a[i]);
//	}
//	printf("\n");
//	int b[] = { 15,21,19,30,26,34,65,49,54,17 };
//	HeapAdjustUp(b, 9);
//	for (int i = 0;i < 10;i++)
//	{
//		printf("%d ", b[i]);
//	}
//	printf("\n");
//}
//void Test2()
//{
//	HeapPush(&hp, 134);
//	HeapPush(&hp, 12);
//	HeapPush(&hp, 16);
//	HeapPush(&hp, 34);
//	HeapPush(&hp, 64);
//	HeapPush(&hp, 42);
//	HeapPush(&hp, 3424);
//	HeapPush(&hp, 4323);
//}
//void Test3()
//{
//	HeapPop(&hp);
//	HeapPop(&hp);
//	HeapPop(&hp);
//}
//void Test4()
//{
//	int arr[] = { 12,23,2,5,25,67,3,28 };
//	HeapCreate(arr, sizeof(arr) / sizeof(arr[0]));
//	for (int i = 0;i < 8;i++)
//	{
//		printf("%d ", arr[i]);
//	}
//	printf("\n");
//}
//void Test5()
//{
//	int arr[] = { 12,23,2,5,25,67,3,28 };
//	HeapSort(arr, 8);
//	for (int i = 0;i < 8;i++)
//	{
//		printf("%d ", arr[i]);
//	}
//	printf("\n");
//}
//void Test6()
//{
//	int arr[] = { 12,23,2,5,25,67,3,28 };
//	Topk(arr, 8, 3);
//	for (int i = 0;i < 3;i++)
//	{
//		printf("%d ", arr[i]);
//	}
//	printf("\n");
//}
//int main()
//{
//	HeapInitial(&hp);
//	/*Test1();
//	Test2();
//	Test3();
//	Test4();*/
//	Test5();
//	Test6();
//	return 0;
//}



BTNode* root;
void test1()
{
	BTNode* n1 = (BTNode*)malloc(sizeof(BTNode));
	BTNode* n2 = (BTNode*)malloc(sizeof(BTNode));
	BTNode* n3 = (BTNode*)malloc(sizeof(BTNode));
	BTNode* n4 = (BTNode*)malloc(sizeof(BTNode));
	BTNode* n5 = (BTNode*)malloc(sizeof(BTNode));
	BTNode* n6 = (BTNode*)malloc(sizeof(BTNode));
	n1->data = 'A';
	n2->data = 'B';
	n3->data = 'C';
	n4->data = 'D';
	n5->data = 'E';
	n6->data = 'F';
	root = n1;
	n1->Left = n2;
	n1->Right = n3;
	n2->Left = n4;
	n2->Right = n5;
	n3->Left = NULL;
	n3->Right = n6;
	n4->Left = NULL;
	n4->Right = NULL;
	n5->Left = NULL;
	n5->Right = NULL;
	n6->Left = NULL;
	n6->Right = NULL;

}
void test2()
{
	BTPrevOrder(root);
	printf("\n");
	BTInOrder(root);
	printf("\n");
	BTPostOrder(root);
	printf("\n");
	BTLevelOrder(root);
	printf("\n");
}
void test3()
{
	printf("%d\n", BTSize(root));
	printf("%d\n", BTMaxDepth(root));
	printf("%d\n", BTLevelKSize(root,2));
}
void test4()
{
	BTNode* tmp = BTFind(root, 'G');
	if (tmp == NULL)
	{
		printf("NULL\n");
	}
	else
	{
		printf("%c\n", tmp->data);
	}
}
int main()
{
	test1();
	test2();
	test3();
	test4();
	return 0;
}